﻿using UnityEngine;
using System.Collections;

public class Cage : MonoBehaviour
{
    public float y = -90;

    private Animation ani;
    private bool open = false;

	void Start()
    {
        ani = GetComponent<Animation>();
	}
	
	void Update()
    {
        if (ani.isPlaying && !open)
        {
            open = true;
        }

        if (!ani.isPlaying && open)
        {
            transform.parent.Find("Owl").Rotate(new Vector3(0, y));
            transform.parent.Find("Owl").Find("owl").GetComponent<Animator>().SetFloat("Height", 0.5f);

            open = false;
        }
	}
}
